﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using TX.Core.Security;
using TX.Core.Data;

namespace TX.Passport.Models
{
    /// <summary>
    /// 操作
    /// </summary>
    [DefaultOrderby("DepartmentId")]
    public class Operation   {
    
        #region 属性
        
        /// <summary>
        /// 
        /// </summary>
        [Required(ErrorMessage="不能为空")]
        [StringLength(-1,ErrorMessage="输入过长，不能超过-1位")]
        [Display(Name="")]
        public string Code { get;set; } 
        
        /// <summary>
        /// 
        /// </summary>
        [Required(ErrorMessage="不能为空")]
        [StringLength(50,ErrorMessage="输入过长，不能超过50位")]
        [Display(Name="")]
        public string Name { get;set; } 
        
        /// <summary>
        /// 
        /// </summary>
        [StringLength(255,ErrorMessage="输入过长，不能超过255位")]
        [Display(Name="")]
        public string Description { get;set; } 
        
        /// <summary>
        /// 
        /// </summary>
        [Required(ErrorMessage="不能为空")]
        [Display(Name="")]
        public int GroupId { get;set; } 
        
        #endregion

        #region 关联属性
        
        /// <summary>
        /// 授权
        /// </summary>
        public virtual ICollection<TX.Passport.Models.Authorization> Authorizations { get; set; }
        /// <summary>
        /// 操作组
        /// </summary>
        public virtual TX.Passport.Models.OperationGroup GroupOperationGroup { get; set; }

        #endregion

        #region 构造方法
        /// <summary>
        /// 初始化
        /// </summary>
        public Operation() {
            Authorizations = new HashSet<TX.Passport.Authorization>();
        }
        #endregion

    }
}
